/*
 *
Base 中通过 new 申请100个字节内存空间
Derived 中通过new 申请200个字节内存空间
~Derived 中通过delete 释放200个字节内存空间
~Base 中通过 delete释放100个字节内存空间

 */

#include <iostream>
using namespace std;
class Base{
	public:
		Base(){
			cout << "Base 中通过 new 申请100个字节内存空间" << endl;
		}
		virtual ~Base(){
			cout << "~Base 中通过 delete释放100个字节内存空间" << endl;
		}
};
class Derived:public Base{
	public:
		Derived(){
			cout << "Derived 中通过new 申请200个字节内存空间" << endl;
		}
		~Derived(){
			cout << "~Derived 中通过delete 释放200个字节内存空间" << endl;
		}
};
int main(void){
	Base *pb = new Derived;
	delete pb;
	return 0;
}
